package net.com.hydroPK.net.packethandler;

import net.com.hydroPK.Engine;
import net.com.hydroPK.model.Player;
import net.com.hydroPK.model.misc.PlayerMethods;

public class PlayerOption1 implements Packet {

    public void handlePacket(Player p, int packetId, int packetSize) {
        if (p == null || p.stream == null) {
            return;
        }
        PlayerMethods playerMethods = new PlayerMethods(p);

        //PvP system

        p.enemyIndex = p.stream.readUnsignedWordBigEndian();
        Player opp = Engine.players[p.enemyIndex];
        if (p == null || opp == null || p.isDead) {
            p.resetAttack();
            p.requestFaceTo(65535);
            return;
        }
        p.usingMage = false;
        playerMethods.setAttackPlayer(true);
    }
}
